﻿#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(ui->horizontalSlider_Blue,SIGNAL(valueChanged(int)),this,SLOT(on_horizontalSlider_Red_valueChanged(int)));
    connect(ui->horizontalSlider_Green,SIGNAL(valueChanged(int)),this,SLOT(on_horizontalSlider_Red_valueChanged(int)));
    connect(ui->horizontalSlider_Tran,SIGNAL(valueChanged(int)),this,SLOT(on_horizontalSlider_Red_valueChanged(int)));
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_horizontalSlider_Red_valueChanged(int value)
{
    Q_UNUSED(value);
    int red=ui->horizontalSlider_Red->value();
    int green=ui->horizontalSlider_Green->value();
    int blue=ui->horizontalSlider_Blue->value();
    int tran=ui->horizontalSlider_Tran->value();

    QColor color=QColor::fromRgb(red,green,blue,tran);
    QPalette palette=ui->textEdit->palette();
    palette.setColor(QPalette::Base,color);
    ui->textEdit->setPalette(palette);


}
